<template>
    <div class="counter">
        <div class="top">
            <p class="title">年度游客量对比</p>
            <p class="bg"></p>
        </div>
        <div ref="chartRef" class="chart"></div>
    </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts';
import { ref , onMounted } from 'vue';

const chartRef = ref(null);

onMounted(() => {
    let myChart = echarts.init(chartRef.value);
    myChart.setOption(
        {
            legend: {
                data: ['Allocated Budget', 'Actual Spending']
            },
            radar: {
                // shape: 'circle',
                indicator: [
                { name: 'Sales', max: 6500 },
                { name: 'Administration', max: 16000 },
                { name: 'Information Technology', max: 30000 },
                { name: 'Customer Support', max: 38000 },
                { name: 'Development', max: 52000 },
                { name: 'Marketing', max: 25000 }
                ]
            },
            series: [
                {
                name: 'Budget vs spending',
                type: 'radar',
                data: [
                    {
                    value: [4200, 3000, 20000, 35000, 50000, 18000],
                    name: 'Allocated Budget'
                    },
                    {
                    value: [5000, 14000, 28000, 26000, 42000, 21000],
                    name: 'Actual Spending'
                    }
                ]
                }
            ]
}
)
})
</script>

<style scoped lang="scss">
.counter {
    width: 100%;
    height: 100%;
    background: url(../images/dataScreen-main-lb.png);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    margin: 0 10px;
    margin-right: 20px;
    margin-top: 10px;
    .top {
        margin-left: 20px;
        .title {
            color: #fff;
            font-size: 20px;
        }
        .bg {
            background: url(../images/dataScreen-title.png) no-repeat;
            background-size: 100% 100%;
            width: 68px;
            height: 7px;
            margin-top: 10px;
        }
    }
    .chart {
        height: calc(100% - 30px);
    }
}
</style>